package com.marketing.common;

/**
 * 响应码枚举
 */
public enum ResponseCode {
    
    // 成功
    SUCCESS(200, "操作成功"),
    
    // 参数错误
    PARAM_ERROR(400, "参数错误"),
    PARAM_INVALID(400, "参数无效"),
    PARAM_MISSING(400, "缺少必要参数"),
    
    // 认证授权错误
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "禁止访问"),
    TOKEN_EXPIRED(401, "Token已过期"),
    TOKEN_INVALID(401, "Token无效"),
    
    // 资源错误
    NOT_FOUND(404, "资源不存在"),
    RESOURCE_NOT_FOUND(404, "资源不存在"),
    
    // 业务错误
    BUSINESS_ERROR(500, "业务异常"),
    DATA_EXISTS(500, "数据已存在"),
    DATA_NOT_EXISTS(500, "数据不存在"),
    DATA_DUPLICATE(500, "数据重复"),
    
    // 系统错误
    SYSTEM_ERROR(500, "系统内部错误"),
    SERVICE_UNAVAILABLE(503, "服务不可用"),
    GATEWAY_TIMEOUT(504, "网关超时"),
    
    // 数据库错误
    DATABASE_ERROR(500, "数据库操作异常"),
    DATABASE_CONNECTION_ERROR(500, "数据库连接异常"),
    
    // 第三方服务错误
    THIRD_PARTY_ERROR(500, "第三方服务异常");
    
    private final Integer code;
    private final String message;
    
    ResponseCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
    
    public Integer getCode() {
        return code;
    }
    
    public String getMessage() {
        return message;
    }
}